package com.activitycode.datamodel.dazhomgdianping;

import org.json.*;
import java.util.ArrayList;

public class Businesses {
	
    private String branchName;
    private String ratingSImgUrl;
    private double dealCount;
    private String telephone;
    private double hasDeal;
    private String couponUrl;
    private double productScore;
    private String address;
    private String onlineReservationUrl;
    private String reviewListUrl;
    private String couponDescription;
    private double productGrade;
    private String businessUrl;
    private String photoListUrl;
    private double distance;
    private double avgRating;
    private String name;
    private double hasOnlineReservation;
    private double longitude;
    private String ratingImgUrl;
    private String city;
    private double serviceScore;
    private double hasCoupon;
    private double businessId;
    private ArrayList<Deals> deals;
    private double couponId;
    private double decorationGrade;
    private double serviceGrade;
    private String photoUrl;
    private ArrayList<String> categories;
    private double reviewCount;
    private ArrayList<String> regions;
    private double avgPrice;
    private String sPhotoUrl;
    private double photoCount;
    private double decorationScore;
    private double latitude;
    
    
	public Businesses () {
		
	}	
        
    public Businesses (JSONObject json) {
    
        this.branchName = json.optString("branch_name");
        this.ratingSImgUrl = json.optString("rating_s_img_url");
        this.dealCount = json.optDouble("deal_count");
        this.telephone = json.optString("telephone");
        this.hasDeal = json.optDouble("has_deal");
        this.couponUrl = json.optString("coupon_url");
        this.productScore = json.optDouble("product_score");
        this.address = json.optString("address");
        this.onlineReservationUrl = json.optString("online_reservation_url");
        this.reviewListUrl = json.optString("review_list_url");
        this.couponDescription = json.optString("coupon_description");
        this.productGrade = json.optDouble("product_grade");
        this.businessUrl = json.optString("business_url");
        this.photoListUrl = json.optString("photo_list_url");
        this.distance = json.optDouble("distance");
        this.avgRating = json.optDouble("avg_rating");
        this.name = json.optString("name");
        this.hasOnlineReservation = json.optDouble("has_online_reservation");
        this.longitude = json.optDouble("longitude");
        this.ratingImgUrl = json.optString("rating_img_url");
        this.city = json.optString("city");
        this.serviceScore = json.optDouble("service_score");
        this.hasCoupon = json.optDouble("has_coupon");
        this.businessId = json.optDouble("business_id");

        this.deals = new ArrayList<Deals>();
        JSONArray arrayDeals = json.optJSONArray("deals");
        if (null != arrayDeals) {
            int dealsLength = arrayDeals.length();
            for (int i = 0; i < dealsLength; i++) {
                JSONObject item = arrayDeals.optJSONObject(i);
                if (null != item) {
                    this.deals.add(new Deals(item));
                }
            }
        }
        else {
            JSONObject item = json.optJSONObject("deals");
            if (null != item) {
                this.deals.add(new Deals(item));
            }
        }

        this.couponId = json.optDouble("coupon_id");
        this.decorationGrade = json.optDouble("decoration_grade");
        this.serviceGrade = json.optDouble("service_grade");
        this.photoUrl = json.optString("photo_url");

        this.categories = new ArrayList<String>();
        JSONArray arrayCategories = json.optJSONArray("categories");
        if (null != arrayCategories) {
            int categoriesLength = arrayCategories.length();
            for (int i = 0; i < categoriesLength; i++) {
                String item = arrayCategories.optString(i);
                if (null != item) {
                    this.categories.add(item);
                }
            }
        }
        else {
            String item = json.optString("categories");
            if (null != item) {
                this.categories.add(item);
            }
        }

        this.reviewCount = json.optDouble("review_count");

        this.regions = new ArrayList<String>();
        JSONArray arrayRegions = json.optJSONArray("regions");
        if (null != arrayRegions) {
            int regionsLength = arrayRegions.length();
            for (int i = 0; i < regionsLength; i++) {
                String item = arrayRegions.optString(i);
                if (null != item) {
                    this.regions.add(item);
                }
            }
        }
        else {
            String item = json.optString("regions");
            if (null != item) {
                this.regions.add(item);
            }
        }

        this.avgPrice = json.optDouble("avg_price");
        this.sPhotoUrl = json.optString("s_photo_url");
        this.photoCount = json.optDouble("photo_count");
        this.decorationScore = json.optDouble("decoration_score");
        this.latitude = json.optDouble("latitude");

    }
    
    public String getBranchName() {
        return this.branchName;
    }

    public void setBranchName(String branchName) {
        this.branchName = branchName;
    }

    public String getRatingSImgUrl() {
        return this.ratingSImgUrl;
    }

    public void setRatingSImgUrl(String ratingSImgUrl) {
        this.ratingSImgUrl = ratingSImgUrl;
    }

    public double getDealCount() {
        return this.dealCount;
    }

    public void setDealCount(double dealCount) {
        this.dealCount = dealCount;
    }

    public String getTelephone() {
        return this.telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    public double getHasDeal() {
        return this.hasDeal;
    }

    public void setHasDeal(double hasDeal) {
        this.hasDeal = hasDeal;
    }

    public String getCouponUrl() {
        return this.couponUrl;
    }

    public void setCouponUrl(String couponUrl) {
        this.couponUrl = couponUrl;
    }

    public double getProductScore() {
        return this.productScore;
    }

    public void setProductScore(double productScore) {
        this.productScore = productScore;
    }

    public String getAddress() {
        return this.address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getOnlineReservationUrl() {
        return this.onlineReservationUrl;
    }

    public void setOnlineReservationUrl(String onlineReservationUrl) {
        this.onlineReservationUrl = onlineReservationUrl;
    }

    public String getReviewListUrl() {
        return this.reviewListUrl;
    }

    public void setReviewListUrl(String reviewListUrl) {
        this.reviewListUrl = reviewListUrl;
    }

    public String getCouponDescription() {
        return this.couponDescription;
    }

    public void setCouponDescription(String couponDescription) {
        this.couponDescription = couponDescription;
    }

    public double getProductGrade() {
        return this.productGrade;
    }

    public void setProductGrade(double productGrade) {
        this.productGrade = productGrade;
    }

    public String getBusinessUrl() {
        return this.businessUrl;
    }

    public void setBusinessUrl(String businessUrl) {
        this.businessUrl = businessUrl;
    }

    public String getPhotoListUrl() {
        return this.photoListUrl;
    }

    public void setPhotoListUrl(String photoListUrl) {
        this.photoListUrl = photoListUrl;
    }

    public double getDistance() {
        return this.distance;
    }

    public void setDistance(double distance) {
        this.distance = distance;
    }

    public double getAvgRating() {
        return this.avgRating;
    }

    public void setAvgRating(double avgRating) {
        this.avgRating = avgRating;
    }

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getHasOnlineReservation() {
        return this.hasOnlineReservation;
    }

    public void setHasOnlineReservation(double hasOnlineReservation) {
        this.hasOnlineReservation = hasOnlineReservation;
    }

    public double getLongitude() {
        return this.longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public String getRatingImgUrl() {
        return this.ratingImgUrl;
    }

    public void setRatingImgUrl(String ratingImgUrl) {
        this.ratingImgUrl = ratingImgUrl;
    }

    public String getCity() {
        return this.city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public double getServiceScore() {
        return this.serviceScore;
    }

    public void setServiceScore(double serviceScore) {
        this.serviceScore = serviceScore;
    }

    public double getHasCoupon() {
        return this.hasCoupon;
    }

    public void setHasCoupon(double hasCoupon) {
        this.hasCoupon = hasCoupon;
    }

    public double getBusinessId() {
        return this.businessId;
    }

    public void setBusinessId(double businessId) {
        this.businessId = businessId;
    }

    public ArrayList<Deals> getDeals() {
        return this.deals;
    }

    public void setDeals(ArrayList<Deals> deals) {
        this.deals = deals;
    }

    public double getCouponId() {
        return this.couponId;
    }

    public void setCouponId(double couponId) {
        this.couponId = couponId;
    }

    public double getDecorationGrade() {
        return this.decorationGrade;
    }

    public void setDecorationGrade(double decorationGrade) {
        this.decorationGrade = decorationGrade;
    }

    public double getServiceGrade() {
        return this.serviceGrade;
    }

    public void setServiceGrade(double serviceGrade) {
        this.serviceGrade = serviceGrade;
    }

    public String getPhotoUrl() {
        return this.photoUrl;
    }

    public void setPhotoUrl(String photoUrl) {
        this.photoUrl = photoUrl;
    }

    public ArrayList<String> getCategories() {
        return this.categories;
    }

    public void setCategories(ArrayList<String> categories) {
        this.categories = categories;
    }

    public double getReviewCount() {
        return this.reviewCount;
    }

    public void setReviewCount(double reviewCount) {
        this.reviewCount = reviewCount;
    }

    public ArrayList<String> getRegions() {
        return this.regions;
    }

    public void setRegions(ArrayList<String> regions) {
        this.regions = regions;
    }

    public double getAvgPrice() {
        return this.avgPrice;
    }

    public void setAvgPrice(double avgPrice) {
        this.avgPrice = avgPrice;
    }

    public String getSPhotoUrl() {
        return this.sPhotoUrl;
    }

    public void setSPhotoUrl(String sPhotoUrl) {
        this.sPhotoUrl = sPhotoUrl;
    }

    public double getPhotoCount() {
        return this.photoCount;
    }

    public void setPhotoCount(double photoCount) {
        this.photoCount = photoCount;
    }

    public double getDecorationScore() {
        return this.decorationScore;
    }

    public void setDecorationScore(double decorationScore) {
        this.decorationScore = decorationScore;
    }

    public double getLatitude() {
        return this.latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }


    
}
